<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="824.42">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
    p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
    p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
    p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
    span.s1 {color: #0000bf}
    span.s2 {color: #bf0000}
    span.s3 {color: #007300}
    span.Apple-tab-span {white-space:pre}
  </style>
</head>
<body>
<p class="p1"><b>PV_OddBin<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>Return the odd numbered bins in an FFT buffer</b></p>
<p class="p1"><b>PV_EvenBin<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>Return the even numbered bins in an FFT buffer</b></p>
<p class="p2"><br></p>
<p class="p3"><b>PV_OddBin(buffer)</b></p>
<p class="p3"><b>PV_EvenBin(buffer)</b></p>
<p class="p2"><br></p>
<p class="p3"><b>Examples:</b></p>
<p class="p2"><br></p>
<p class="p4">// resynthesize only odd or even bins</p>
<p class="p2"><br></p>
<p class="p4">{<span class="s1">SinOsc</span>.ar(440 + <span class="s1">SinOsc</span>.kr(0.05).range(0, 440), 0, 0.5)}.play; <span class="s2">// a sample sig</span></p>
<p class="p2"><br></p>
<p class="p4"><span class="s1">SynthDef</span>(<span class="s3">\evenbin</span>, {<span class="s1">arg</span> fftbuf1, fftbuf2;</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s1">var</span> in, chain1, chain2, out1, out2;</p>
<p class="p4"><span class="Apple-tab-span">	</span>in = <span class="s1">SinOsc</span>.ar(440 + <span class="s1">SinOsc</span>.kr(0.05).range(0, 440), 0, 0.5);</p>
<p class="p4"><span class="Apple-tab-span">	</span>chain1 = <span class="s1">FFT</span>(fftbuf1, in);</p>
<p class="p4"><span class="Apple-tab-span">	</span>chain1 = <span class="s1">PV_EvenBin</span>(chain1);</p>
<p class="p4"><span class="Apple-tab-span">	</span>out1 = <span class="s1">IFFT</span>(chain1);</p>
<p class="p4"><span class="Apple-tab-span">	</span>chain2 = <span class="s1">FFT</span>(fftbuf2, in);</p>
<p class="p4"><span class="Apple-tab-span">	</span>chain2 = <span class="s1">PV_OddBin</span>(chain2);</p>
<p class="p4"><span class="Apple-tab-span">	</span>out2 = <span class="s1">IFFT</span>(chain2);</p>
<p class="p5">//<span class="Apple-tab-span">	</span>Out.ar(0, out1 + out2); // add back together</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s1">Out</span>.ar(0, [out1, out2]); // or split apart</p>
<p class="p4"><span class="Apple-tab-span">	</span>}).load(s);</p>
<p class="p2"><br></p>
<p class="p4">s.boot;</p>
<p class="p2"><br></p>
<p class="p5">// the fft buf</p>
<p class="p4">s.sendMsg(<span class="s3">\b_alloc</span>, 0, 2048);</p>
<p class="p4">s.sendMsg(<span class="s3">\b_alloc</span>, 1, 2048);</p>
<p class="p2"><br></p>
<p class="p5">// start the synth</p>
<p class="p4">s.sendMsg(<span class="s3">\s_new</span>, <span class="s3">\evenbin</span>, z = s.nextNodeID, 0, 1, <span class="s3">\fftbuf1</span>, 0, <span class="s3">\fftbuf2</span>, 1);</p>
<p class="p5">// free it</p>
<p class="p4">s.sendMsg(<span class="s3">\n_free</span>, z);</p>
<p class="p4">s.sendMsg(<span class="s3">\b_free</span>, 0);</p>
<p class="p4">s.sendMsg(<span class="s3">\b_free</span>, 1);</p>
<p class="p2"><br></p>
<p class="p4">s.quit</p>
<p class="p2"><br></p>
</body>
</html>
